#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.sympy import *

# Entradas
with display_block('Entradas'):
    while True:
        a = One * randint(1, 10) / randint(1, 10)
        b = One * randint(1, 10) / randint(1, 10)
        mu = b ** 2 / a
        L = Three / (4 * mu * b)

        # L deve ser simples
        num, den = L.as_numer_denom()
        if den > 5 or num > 20:
            continue
        y0 = oneof(0, -L, -L / 2)
        y1 = y0 + L

        # mu deve ser simples
        num, den = mu.as_numer_denom()
        if den > 5 or num > 10:
            continue
        break

with display_block('Respostas'):
    correta = mu
    retangular = (Two / 3) ** (Two / 3) * correta
    dis_1 = correta * oneof(Two, Half)
    dis_2 = correta * oneof(sqrt(2), sqrt(3), Two ** (One / 3), Three ** (One / 3))
